﻿using System.Drawing;
using DevExpress.XtraGrid;
using DevExpress.XtraGrid.Views.Grid;

namespace MicropleSoft.Controls.Style
{
    public class RowStyleConditionController
    {
        #region AddStyleFormatCondition
        public static void AddStyleFormatCondition(GridView gridView, string colName, string expression,Color color)
        {
            var styleFormatCondition = new StyleFormatCondition();
            styleFormatCondition.Appearance.BackColor = color;
            styleFormatCondition.Appearance.Options.UseBackColor = true;
            styleFormatCondition.Column = gridView.Columns[colName];
            styleFormatCondition.Expression = expression;
            styleFormatCondition.Condition = FormatConditionEnum.Expression;
            styleFormatCondition.ApplyToRow = true;
            gridView.FormatConditions.Add(styleFormatCondition);
        }
        public static  void AddStyleFormatCondition(GridView gridView, string colName,string expression)
        {
            AddStyleFormatCondition(gridView, colName, expression, Color.LightPink);
        }
        #endregion
    }
}
